UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Asd5n7pEvhCHTG3plGnOPFR79YYVnTk4PitpuDbLS2s=' 
WHERE 
  key_id = '96259fc7af761d0822c6311870523057bb29b0f60c97b75da5bfe3c595ec4e46' 
  AND (
    token = 'Asd5n7pEvhCHTG3plGnOPFR79YYVnTk4PitpuDbLS2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022