UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u+jomd/oTX+w5tWsz+9b188cXqQy3OjqA+c2g3NWHEE=' 
WHERE 
  key_id = '34d21a069c42d0aab51132f4a07e143660baa3dcd42972b391c2e2801052f583' 
  AND (
    token = 'u+jomd/oTX+w5tWsz+9b188cXqQy3OjqA+c2g3NWHEE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043