UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DT7xiIIjdjHGBMMdKfBTnhGy7UymaJvmDkCEeyqaxRM=' 
WHERE 
  key_id = 'f1c11cf3959f15a07d1ed50f4a4c7b615a5bf0e46d2c039d8c902e9c9c220aad' 
  AND (
    token = 'DT7xiIIjdjHGBMMdKfBTnhGy7UymaJvmDkCEeyqaxRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023