UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ye8kh7O6Ec/mvLLMLAcFuIR8BE7i/Oyaf6uZrcPOVew=' 
WHERE 
  key_id = 'dd4ade04c02c8f4d260dcb770be38aa7538b60e78edc723b7e860d0baa013cc6' 
  AND (
    token = 'ye8kh7O6Ec/mvLLMLAcFuIR8BE7i/Oyaf6uZrcPOVew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042