UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+TxjsL9ALve72hP/Ccbp1bVknr+t8b2MgvWiCRRatvU=' 
WHERE 
  key_id = 'df4c41de16df7ae6f147fe4637635d03a7c0a9863985c0aceeea6c19212ec46c' 
  AND (
    token = '+TxjsL9ALve72hP/Ccbp1bVknr+t8b2MgvWiCRRatvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042