UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a9t+ulIfL2lfq9N44DkhEnJpYYCjcMdgtA/Fo5u98Ns=' 
WHERE 
  key_id = '237d4c1893e84f7f98ae1007749a172122762bbec656a96cc400cbdd3b8177ef' 
  AND (
    token = 'a9t+ulIfL2lfq9N44DkhEnJpYYCjcMdgtA/Fo5u98Ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039