UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ta9FR/nzw8iMIpvv8TseqEtGib+ecWHQ1Jqi0f92GnA=' 
WHERE 
  key_id = '5f071a8ea5d8a97f20135ac24c46c2ab101afa0883876cbe2bc260b48ae81d9c' 
  AND (
    token = 'ta9FR/nzw8iMIpvv8TseqEtGib+ecWHQ1Jqi0f92GnA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034