UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZxqwoLWolOP1LmsrSacuEzLq071Qo66WYD2aqcZwkbM=' 
WHERE 
  key_id = 'a4d7a030e4a6868933af9a9cbd0e49c46f49b44d4653bc8d8c067532255fe99b' 
  AND (
    token = 'ZxqwoLWolOP1LmsrSacuEzLq071Qo66WYD2aqcZwkbM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025