UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UHOYaM8CPPUaHoVoOSWQsjNRgTT6hrP+MKShIM1KU9Q=' 
WHERE 
  key_id = '22c3d6057a2a6fbffe86bad6656038fb4ae3ef45fc39c2221a820ffae0320865' 
  AND (
    token = 'UHOYaM8CPPUaHoVoOSWQsjNRgTT6hrP+MKShIM1KU9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057