UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U8ZW7/gRpzgt+vgGQyltrsZATPxotTXnx0Kllx3miSM=' 
WHERE 
  key_id = '83d8cd1c9768d1877a41b5ebc39ec9618e0293f9c364a727f69380d048b39168' 
  AND (
    token = 'U8ZW7/gRpzgt+vgGQyltrsZATPxotTXnx0Kllx3miSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043