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

Query time 0.00022