UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G8di7hr8nHjXbHP00xkycWIUl36WrVSyiPTqBATFsQM=' 
WHERE 
  key_id = 'd1e7309868c82cf4236224abc9738aabafdd3f2ed99ac0f454f2fbc78037b3a2' 
  AND (
    token = 'G8di7hr8nHjXbHP00xkycWIUl36WrVSyiPTqBATFsQM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034