UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A65HwBbM9rMvWVmbFLWdRD2064Q/Q97Ud82/t2nMPsI=' 
WHERE 
  key_id = '973d6db604764cb5c996f8f11990f531278fbad36aaca9e4b12fe4b7a4fdecd2' 
  AND (
    token = 'A65HwBbM9rMvWVmbFLWdRD2064Q/Q97Ud82/t2nMPsI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038