UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CPdtlIki1mTRyaSoSTxjjwWTonXd+R5cDb6FopYPD/E=' 
WHERE 
  key_id = 'a0eba1a48df42b842a56545f311695b51167129843ebdef0a2a74e5be9271b9b' 
  AND (
    token = 'CPdtlIki1mTRyaSoSTxjjwWTonXd+R5cDb6FopYPD/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040