UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zSZtQ1ta1npWd9c6xWVvKM1GCAZn9fdi1rYROKh+6Zg=' 
WHERE 
  key_id = 'ac42c2399424c57d1eedbd18edeb5616602ec653292529224853922574ccb7a5' 
  AND (
    token = 'zSZtQ1ta1npWd9c6xWVvKM1GCAZn9fdi1rYROKh+6Zg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024