UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Q04oHRaF/yH9bFF3VxfKRm3BMEP00XndvtnjOf5ubw=' 
WHERE 
  key_id = '789f7f379f4be54a06c48e557823076d8866b3e84e59a681b058f1da8ca565ff' 
  AND (
    token = '0Q04oHRaF/yH9bFF3VxfKRm3BMEP00XndvtnjOf5ubw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067