UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JSZFiygqYmEFRM9kvwhz5b5JwxJwOvZLhaobgaXzzrk=' 
WHERE 
  key_id = '5c4d4fe7dae14a0cc668293829e07cfc2fb6e560896ccc44e1b59f28b2a0bd6e' 
  AND (
    token = 'JSZFiygqYmEFRM9kvwhz5b5JwxJwOvZLhaobgaXzzrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045