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

Query time 0.00021