UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z+mYYCCHWtvqttOkCu7/cWlj4gysQohoD9+Q9wJZ2nM=' 
WHERE 
  key_id = 'd940438220c6035d54f1951f2fbe40070a9bc4b524c38b99c194a176281f5d9b' 
  AND (
    token = 'Z+mYYCCHWtvqttOkCu7/cWlj4gysQohoD9+Q9wJZ2nM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041