UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BWb2X62yQaFCDFMo6tmzyAgmxx0et3FUtPEYkD/f1go=' 
WHERE 
  key_id = '8d00f6cb831ef7a6cccf139636550c283f747c7452744bc85cfa585cb35ec4da' 
  AND (
    token = 'BWb2X62yQaFCDFMo6tmzyAgmxx0et3FUtPEYkD/f1go=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028