UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k/3GYrbRIGyKjDdVawhZBGcZ1cNQIIAbfNyIdwOLcbg=' 
WHERE 
  key_id = 'afaf576233eec699521ba04a3189e490dd918a5a0efb66cb437c10d8e87e9640' 
  AND (
    token = 'k/3GYrbRIGyKjDdVawhZBGcZ1cNQIIAbfNyIdwOLcbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030