UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lvN0xyzLXPMxtf4LB0YHj4zjxMsPP6Z7Bb+9hG6FiSY=' 
WHERE 
  key_id = 'bf0152db186d7463a47be38835d503d175dd61209eada7ae7b4e5a80e07f3b0d' 
  AND (
    token = 'lvN0xyzLXPMxtf4LB0YHj4zjxMsPP6Z7Bb+9hG6FiSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038