UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'prh0ko3j46iyqoFMFes4/2SM4ZNQ02a0DdDx0jit2tQ=' 
WHERE 
  key_id = 'a923f1aedb20d25c304c85a926f4fb6381ee8a793344ce29afef583748cc6038' 
  AND (
    token = 'prh0ko3j46iyqoFMFes4/2SM4ZNQ02a0DdDx0jit2tQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031