UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7GspMsqS1y1XY+xAudXrS4H2vjLpFr22OueugGnGNPY=' 
WHERE 
  key_id = '3ee2d7d6a7fbe2d56b3c484d06f06a00517dcba56181a7653ec488a8e32d838e' 
  AND (
    token = '7GspMsqS1y1XY+xAudXrS4H2vjLpFr22OueugGnGNPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016