UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CJpv82mT76h/xyTp65Ic76DoLM07MWi1a/MiZuWa8E8=' 
WHERE 
  key_id = '4afc4654296b6622ee61aaf44a420757c6dd510ff479be3aa4d7696687f4afe7' 
  AND (
    token = 'CJpv82mT76h/xyTp65Ic76DoLM07MWi1a/MiZuWa8E8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042