UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EPRgy80M5htyQk0T9jD7IsdW1IafrER3duf9gB+KvDM=' 
WHERE 
  key_id = '454ff0e4f3f0d725b4f07879e71c0782ecd0ec6768d3736a2630101c67000544' 
  AND (
    token = 'EPRgy80M5htyQk0T9jD7IsdW1IafrER3duf9gB+KvDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022