UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yw6lImlA0w44iMGm15dMjm/PH633QqlpQ/ioc7zD5/A=' 
WHERE 
  key_id = 'c51e5ff60b3d945f9667bf0f21e2b480eabadaaac8898da8a478d1a3d483625d' 
  AND (
    token = 'yw6lImlA0w44iMGm15dMjm/PH633QqlpQ/ioc7zD5/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050