UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bROQ7X2cB9yhfp1ILlN4wikMmOLVjt+wIKoEU+gc/Sc=' 
WHERE 
  key_id = '5f63b3703681da1d3bb6331396db6fb3735a1eb80dcca7009976d633e1a8420d' 
  AND (
    token = 'bROQ7X2cB9yhfp1ILlN4wikMmOLVjt+wIKoEU+gc/Sc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022