UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jrPgPmwemV56WjFThsPl/me1X4ckIryxQiCznv0pfDo=' 
WHERE 
  key_id = '4966baffeeecf4c20fed4bccaa5ca965a903fb7157740275493f5c2632891098' 
  AND (
    token = 'jrPgPmwemV56WjFThsPl/me1X4ckIryxQiCznv0pfDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016