UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y+4bIYAD9xk8gyjlMXQePHa37f3cb/qjgn3B4S3pvdg=' 
WHERE 
  key_id = '78ca1b4167fabecd2fa49cf243498c66dff75e5787984beb645dfcdb32f02581' 
  AND (
    token = 'y+4bIYAD9xk8gyjlMXQePHa37f3cb/qjgn3B4S3pvdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032