UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XOght914lqOPBanQWwe9zkZelBONRKWGkOol336kzXc=' 
WHERE 
  key_id = '87047508efbfc4839350a3d6a9b7c04a5265f5a32017a25c22aa997e069e83e1' 
  AND (
    token = 'XOght914lqOPBanQWwe9zkZelBONRKWGkOol336kzXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024