UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g+ZzWu9ck72uN2+1CL5xYJOV3bBDb2gHbEyVhPVd5SM=' 
WHERE 
  key_id = 'a4b7aacfced845b738c24f4bf314137b83df2b68dd6198b19e98a6b9426dd094' 
  AND (
    token = 'g+ZzWu9ck72uN2+1CL5xYJOV3bBDb2gHbEyVhPVd5SM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024